﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Eatime.Bussiness;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Eatime.DataServiceProxy;
using Eatime.Entitys;
using System.Net.Http;

namespace Eatime.UnitTestLibrary
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            var shopParams = new ShopParams()
            {
                Lat = 39.9750527965564,
                Lng = 116.334785461426,
                PageIndex = 1,
                PageSize = 1,
                ShopCatIds = "1",
                Distance = 1000,
                Title = ""
            };
            var result = new DataServicesProxy().GetDatas<Shops, ShopParams>(shopParams, HttpMethod.Get, "Shop/ShopsForMobile");

        }

        [TestMethod]
        public void TestMethod2()
        {
            var shopParams = new ShopReview()
            {
                ShopReviewId=0,
                Created=DateTime.Now,
                Updated=DateTime.Now,
                ReviewContent="ffffff",
                DeliverSpeed=8,
                Taste=8,
                ShopId=1,
                QoS=6,
                DeviceUniqueId="w58tGf6vg5cyQTQ6M+3iMaQVFLU="
            };
            var result = new DataServicesProxy().GetDatas<MessageResult, ShopReview>(shopParams, HttpMethod.Post, "Shop/AddShopReview");

        }
        [TestMethod]
        public void AddFavoriteShopTest()
        {
            Shop shop = new Shop();
            shop.Id = Guid.Parse("f117b120-3cad-4089-82a2-2b7d8b9d1381");
            ShopService.AddFavoriteShop(shop);
            bool flag = false;
            foreach (var item in ShopService.GetFavoriteShop())
            {
                if (item.Id==shop.Id)
                {
                    flag = true;
                    break;
                }
            }
            Assert.AreEqual(flag,true);
        }
        [TestMethod]
        public void GetShopMenuTest()
        {
            MenuParams menuParams = new MenuParams(){shopid = 1};
            List<Menu> menus = ShopService.GetShopMenu(menuParams);

        }
        [TestMethod]
        public void GetShopReview()
        {
            ShopReviewData shopReviews = new DataServicesProxy().GetDatas<ShopReviewData, ShopViewParam>(new ShopViewParam() { shopid = "1",pagesize = 20,pageindex = 1}, HttpMethod.Get, "Shop/GetShopReviews");
        }
    }
}
